<template>
	<view class="setp">
		<view class="step-list">
			<view class="item" v-for="(item,index) in stepData" :key="index">
				<view class="i" @click="change(item,index)">
					<!-- <template v-if="index == step"> -->
					<!-- 选中状态 -->
					<template v-if="item.id == step">
						<view class="iitem">
							<image src="../../static/Group5.png" mode=""></image>

						</view>

						<view class="color2">{{item.name}}</view>
					</template>

					<template v-else>
						<template v-if="compeleteList[item.classify]">
							<!-- 已完成 -->
							<image src="../../static/Group6.png" mode=""></image>
							<view class="color3">{{item.name}}</view>
						</template>
						<template v-else>
							<!-- 未选中未完成 -->
							<image src="../../static/Group11.png" mode=""></image>
							<view class="color1">{{item.name}}</view>
						</template>
					</template>
				</view>
				<view class="h" v-if="index  != stepData.length-1"
					:style="{'backgroundColor':item.isActive?'rgba(39, 177, 134, 1)':'#E7F0FA'}"></view>
			</view>

		</view>
	</view>
</template>

<script>
	export default {
		name: "ryf-step",
		props: {
			stepData: {  
				type: Array,
				default: function() {
					return [
					// 	{
					// 	name: '单点评吸',
					// 	isActive: false
					// }, {
					// 	name: '对比评吸',
					// 	isActive: false
					// }, {
					// 	name: '三点评吸',
					// 	isActive: false
					// }, {
					// 	name: '竞品评价',
					// 	isActive: false
					// }, {
					// 	name: '单料烟评吸',
					// 	isActive: false
					// },
					]
				}
			},
			// isActive: {
			// 	type: Array,
			// 	default: function() {
			// 		return []
			// 	}
			// },
			step: {
				type: Number,
				default: 0
			},
			title: {
				type: String,
				default: '单点评吸'
			},
			// 完成状态
			compeleteList: {
				type: Object,
				default: function () { return {0:false, 1:false, 2:false, 3:false, 4:false, 5:false} }
			}
		},
		computed: {

		},
		data() {
			return {

			}
		},

		methods: {
			bgColor(item) {
				let align = '#E7F0FA';
				if (item.isActive) {
					align = 'rgba(39, 177, 134, 1)'
				}
				return align
			},
			change(item,index){
				// console.log(item )
				this.$emit('update:step', index)
				this.$emit('update:title', item.name)
				this.$emit('step_change', item.id,item.name)
			},
		},
		mounted() {

		},
	}
</script>

<style lang="scss" scoped>
	.iitem {
		display: flex;
		// align-items: c;
	}

	.setp {
		padding: 25rpx 70rpx;

		.step-list {
			display: flex;
			align-items: center;
			justify-content: center;

			.item {
				display: flex;
				align-items: center;
				position: relative;

				&:last-child {
					.i {
						margin-right: 0;
					}

				}

				.h {
					width: 120rpx;
					height: 9.88rpx;
				}

				.i {
					display: flex;
					flex-flow: column;
					justify-content: center;
					align-items: center;
					font-size: 11rpx;
					margin-right: 84rpx;
					width: max-content;
					font-weight: bold;
					position: relative;
					z-index: 2;


					image {
						width: 45rpx;
						height: 45rpx;
						// position: absolute;
					}
				}

				.color1 {
					color: #AABBCE;

					position: relative;
					top: -5rpx;
				}

				.color2 {
					color: #FFC24D;
					position: relative;
					top: -5rpx;
				}

				.color3 {
					color: #27B186;
					position: relative;
					top: -2rpx;
				}

				.h {
					position: absolute;
					z-index: 1;
					top: 17.56rpx;
					left: 25rpx;
				}

			}
		}
	}
</style>